#include<iostream>
using namespace std;

int isSymbol(int ch) 
{
	if(ch=='?'||ch=='!'||ch=='.'||ch==','||ch==' ')
		return 1;
	return 0;
}

void Fz(char *s)
{
	int i=0;
	while(s[i]!='\0')
	{
		while(s[i]!='\0'&&isSymbol(s[i]))
		{
			cout<<s[i];
			i++; 
		}
		int m=i;
		while(s[i]!='\0'&&!isSymbol(s[i]))
		{
		 i++;
		}
		int n=i-1;
		for(int j=n;j>=m;j--)
		{
			cout<<s[j];
		}
	}
}

int main()
{
	char s[100]="I like c++";
	Fz(s);
	return 0;
}
